package com.touchealth.test.collection;

import com.touchealth.test.bean.Book;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author zhangyanqiang
 * @date 2020/5/21
 **/
public class SortList {

    public static void main(String[] args) {
        Book book1 = new Book();
        Book book2 = new Book();
        book1.setHeight(0);
        book1.setName("zhangyanqiang");
        book2.setHeight(0);
        book2.setName("hehe");

        List<Book> list = new ArrayList<>();
        list.add(book2);
        list.add(book1);
        list.sort(Comparator.comparing(Book::getHeight));
        System.out.println(list.size());

    }
}
